﻿
using RpcHelper;

using Wedonek.RpcStore.Service.DAL;
using Wedonek.RpcStore.Service.Interface;
using Wedonek.RpcStore.Service.Model;

namespace Wedonek.RpcStore.Service.Collect
{
        internal class ServerRegionCollect : BasicCollect<ServerRegionDAL>, IServerRegionCollect
        {
                public ServerRegion[] Gets ()
                {
                        return this.BasicDAL.Gets ();
                }
                public void Set (int id, string name)
                {
                        if (this.BasicDAL.CheckName (name))
                        {
                                throw new ErrorException ("rpc.region.name.repeat");
                        }
                        this.BasicDAL.Set (id, name);
                }

                public int Add (string name)
                {
                        if (this.BasicDAL.CheckName (name))
                        {
                                throw new ErrorException ("rpc.region.name.repeat");
                        }
                        return this.BasicDAL.Add (name);
                }
                public void Drop (int id)
                {
                        this.BasicDAL.Drop (id);
                }

                public ServerRegion[] Gets (int[] ids)
                {
                        return this.BasicDAL.Gets (ids);
                }
        }
}
